<script>
<?php $this->placeholder('onReady')->captureStart();?>
 
	$('#boton_editar').live('click',function(){
		
        $('#notas').hide();
        $('#text').show();
        $(this).hide();
        $('#boton_guardar').show();
       
        $('textarea[name=text_notas]').val($('#notas').text())

	}); 


    $('#boton_guardar').live('click',function(){
		
        var txt = $('textarea[name=text_notas]').val()
        $('#notas').show();
        $('#text').hide();
        $(this).hide();
        $('#boton_editar').show();
        
        $('#notas').load('/cuentas/notas',{anio:'<?=$this->anio?>',notas:txt});
        
    })  
      
      
    $('#notas').load('/cuentas/notas',{anio:'<?=$this->anio?>'});   
      
 
<?php $this->placeholder('onReady')->captureEnd() ?>
</script>

<style>
#main dt {padding-top:5px;font-size:1.2em}
#main dd {margin-left:6em;padding-top:5px;}  
#main b {font-weight:bold}
</style>




<div class="contenedor_tablesorter">
<? if($this->anio || $this->mes):?>

* Ultimo mes cerrado de <?=$this->anio?> <?=$this->lastmescerrado ? Sgit_Util_Meses::run($this->lastmescerrado): '"Todavía no se ha cerrado ningun mes"' ?>

<table  class="tabla_resumen_economico" width="80%" border="0"> 
    <tr>
       	<th rowspan="3" width="20%"><?php echo $this->translate('Seguimiento Económico');?> <br /> CC Data Centers IMC<br /><?=$this->mes($this->mes);?> <?=$this->anio?> <?= $this->mescerrado ? $this->translate('cerrado') : $this->translate('abierto');?></th>
       	<th colspan="4"><h1 class="h1_head ui-widget-header"><?php echo $this->translate('Cierre');?> <?=$this->mes($this->mes);?> <?=$this->anio?> <?=$this->nombre_zona?></h1></th>
    </tr>
    <tr>
   	    <th colspan="2" width="40%" class="ui-state-active">YTD<?=$this->anio?></th>
       	<th colspan="2" width="40%" class="ui-state-active">C<?=$this->anio?></th>
    </tr>
    <tr>
        	<th width="20%" class="ui-state-active ui-corner-top">A <?=$this->anio?></th>
        	<th width="20%" class="ui-state-active ui-corner-top">P <?=$this->anio?></th>
        	<th width="20%" class="ui-state-active ui-corner-top">A <?=$this->anio?></th>
        	<th width="20%" class="ui-state-active ui-corner-top">P <?=$this->anio?></th>
    </tr>
    
    <tr>
   	    <th class="concepto ui-state-active ui-corner-top"><?php echo $this->translate('Estructura');?></th>

        <td class="ui-state-highlight ui-corner-all" valign="top">

            <?=$this->fTablaCuentas($this->estructura['ytd']['A'])?>
        </td>
       	<td class="ui-state-highlight ui-corner-all">
            <?=$this->fTablaCuentas($this->estructura['ytd']['P'])?>
        </td>
       	<td class="ui-state-highlight ui-corner-all">
            <?=$this->fTablaCuentas($this->estructura['C']['A'])?>
        </td>
        <td class="ui-state-highlight ui-corner-all">
            <?=$this->fTablaCuentas($this->estructura['C']['P'])?>
        </td>   
    </tr>
    <tr>
        	<th class="concepto ui-state-active"><?php echo $this->translate('Servicio Alojamiento');?></th>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->alojamiento['ytd']['A'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->alojamiento['ytd']['P'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->alojamiento['C']['A'])?>
            </td>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->alojamiento['C']['P'])?>
            </td>     
    </tr>
        <tr>
        	<th class="concepto ui-state-active"><?php echo $this->translate('Servicios Datos/MMR');?></th>
        	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->mmr['ytd']['A'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->mmr['ytd']['P'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->mmr['C']['A'])?>
            </td>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->mmr['C']['P'])?>
            </td>  
        </tr>
        
        
        <tr>
        	<th class="concepto ui-state-active"><?php echo $this->translate('Servicio Electricidad');?></th>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->electricidad['ytd']['A'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->electricidad['ytd']['P'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->electricidad['C']['A'])?>
            </td>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->electricidad['C']['P'])?>
            </td>    
        </tr>
        
        <tr>
        	<th class="concepto ui-state-active"><?php echo $this->translate('Servicio Despliegue IT');?></th>
        	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->despliegue['ytd']['A'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->despliegue['ytd']['P'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->despliegue['C']['A'])?>
            </td>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->despliegue['C']['P'])?>
            </td>    
        </tr>
        <tr>
        	<th class="concepto ui-state-active"><?php echo $this->translate('Varios');?><br /><a class="utiladd ui-state-active" href="/varios/editar/anio/<?=$this->anio?>">Editar</a></th>
        	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->varios['ytd']['A'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->varios['ytd']['P'])?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->varios['C']['A'])?>
            </td>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->varios['C']['P'])?>
            </td>   
        </tr>
        
        <tr>
        	<th class="concepto ui-state-active  ui-corner-bottom"><?php echo $this->translate('Total');?> DC</th>
        	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->total['ytd']['A'],true)?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->total['ytd']['P'],true)?>
            </td>
           	<td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->total['C']['A'],true)?>
            </td>
            <td class="ui-state-highlight ui-corner-all">
                <?=$this->fTablaCuentas($this->total['C']['P'],true)?>
            </td>   
        </tr>
        <tr>
        <td colspan="5">* <?php echo $this->translate('Datos en miles de euros');?></td>
        </tr>

</table>


<table class="tablesorter">
<caption>Estado de aprobación en comite de cambio</caption>
<tr>
<td rowspan="<?=count($this->zonas)+1?>">Alojamiento</td>
<td></td>
<?for($i=1;$i<=12;$i++):?>
<td><?=$this->mes($i)?></td>
<?endfor?>
</tr>
<?foreach($this->estados['Alojamiento'] as $id_zona => $zona):?>
<tr>
    <td><?=$this->zona($id_zona)?></td>
    <?for($i=1;$i<=12;$i++):?>
    <td width="7%"><span class="ui-icon ui-icon-<?=$zona[$i]['estado'] ? 'locked':'unlocked'?>" title="<?=$zona[$i]['estado'] ? 'Mes cerrado':'Mes Abierto'?>"></span></td>
    <?endfor?>
</tr>
<?endforeach?>
<tr>
<td rowspan="<?=count($this->zonas)+1?>">Electricidad</td>
<td></td>
</tr>
<?foreach($this->estados['Electricidad'] as $id_zona => $zona):?>
<tr>
    <td><?=$this->zona($id_zona)?></td>
    <?for($i=1;$i<=12;$i++):?>
    <td width="7%"><span class="ui-icon ui-icon-<?=$zona[$i]['estado'] ? 'locked':'unlocked'?>"></span></td>
    <?endfor?>
</tr>
<?endforeach?>
<tr>
<td rowspan="<?=count($this->zonas)+1?>">MMR</td>
<td></td>
</tr>
<?foreach($this->estados['MMR'] as $id_zona => $zona):?>
<tr>
    <td><?=$this->zona($id_zona)?></td>
    <?for($i=1;$i<=12;$i++):?>
    <td width="7%"><span class="ui-icon ui-icon-<?=$zona[$i]['estado'] ? 'locked':'unlocked'?>"></span></td>
    <?endfor?>
</tr>
<?endforeach?>
</table>




<div id="main" style="width:100%">

	<div style="width:45%;;float:left">
        <div id="notas" class="notas_cuentas ui-state-highlight"></div>
        <div id="text" style="display: none;">
            <textarea name="text_notas" cols="60" rows="15"></textarea>
        </div>
        <a class="button_ira"  id="boton_editar">Editar Notas <?=$this->anio?></a>
        <a class="button_ira"  id="boton_guardar" style="display:none">Guardar Notas</a>
    </div>
   

    <div class="notas_cuentas ui-state-highlight" style="width:45%;float: right;">
        <dl>
		<?foreach ( $this->notas_comite as $v ):?>
		<?="<dt>" . $this->mes($v['mes']).' '  . $v['anio'] .' ' .$this->zona($v['id_zona']).' '.$v['tipo']. ' '.$this->user($v['propone_cambio']). "</dt><dd>" . $this->Text( $v['notas_cambio'] ) . "</dd>";?>
        <?endforeach?>
		</dl>
        
        <br />
    </div>
    <br /><br />

</div>

<div style="clear: both;"></div>
<?endif?>
</div>


<?if($this->anio):
echo $this->msg('Documentos Adjuntos');
echo $this->Documentos($this->controllerName."-".$this->actionName."-".$this->anio);
endif?>
